﻿using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using zhangmenren.IService;
using zhangmenren.Models;
using zhangmenren.ViewModel;
using zhangmenren.Repository;

namespace zhangmenren.Service
{
    public class ProductService : IProductService
    {
        private ProductRepository productRepository = new ProductRepository();
        public Task<int> Add(ProductsEntity entity)
        {
            return Task.FromResult(productRepository.Add(entity));
        }

        public Task<int> Del(int id)
        {
            return Task.FromResult(productRepository.Del(id));
        }

        public Task<IEnumerable<ProductModel>> FindByUserId(int userId)
        {
            return Task.FromResult(productRepository.FindByUser(userId));
        }

        public Task<IEnumerable<ProductModel>> Selelct(int count = 0)
        {
            return Task.FromResult(productRepository.Select(count));
        }
    }
}
